/* Copyright (c) 2004-2024 peigen.info. All rights reserved. */

package info.peigen.hotpot.business.account.manage.repository.mapper;

import info.peigen.hotpot.business.account.core.repository.entity.AccountLogEntity;
import info.peigen.hotpot.component.data.repository.beetlsql.mapper.AbstractBeetlSqlManageMapper;
import org.beetl.sql.mapper.annotation.Select;
import org.beetl.sql.mapper.annotation.Sql;
import org.beetl.sql.mapper.annotation.Update;

/**
 * <b>(AccountLogManageMapper)</b>
 * 管理后台 "账户流水记录" 数据库映射服务
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2023-08-29
 */
@SuppressWarnings("unused")
public interface AccountLogManageMapper extends AbstractBeetlSqlManageMapper<AccountLogEntity> {

    // 唯一索引[account_log_id]
    @Sql("select * from account_log where account_log_id = ?")
    @Select
    AccountLogEntity findByAccountLogId(String accountLogId);

    @Sql("select * from account_log where account_log_id = ? for update")
    @Select
    AccountLogEntity lockByAccountLogId(String accountLogId);

    @Sql("delete from account_log where account_log_id = ?")
    @Update
    void deleteByAccountLogId(String accountLogId);

    // 索引[trans_log_id]
    @Sql("select * from account_log where trans_log_id = ?")
    @Select
    AccountLogEntity findByTransLogId(String transLogId);

    @Sql("delete from account_log where trans_log_id = ?")
    @Update
    void deleteByTransLogId(String transLogId);

    // 索引[trade_id]
    @Sql("select * from account_log where trade_id = ?")
    @Select
    AccountLogEntity findByTradeId(String tradeId);

    @Sql("delete from account_log where trade_id = ?")
    @Update
    void deleteByTradeId(String tradeId);

    // 索引[trans_code]
    @Sql("select * from account_log where trans_code = ?")
    @Select
    AccountLogEntity findByTransCode(String transCode);

    @Sql("delete from account_log where trans_code = ?")
    @Update
    void deleteByTransCode(String transCode);

    // 索引[account_id]
    @Sql("select * from account_log where account_id = ?")
    @Select
    AccountLogEntity findByAccountId(String accountId);

    @Sql("delete from account_log where account_id = ?")
    @Update
    void deleteByAccountId(String accountId);

    // 索引[direction]
    @Sql("select * from account_log where direction = ?")
    @Select
    AccountLogEntity findByDirection(String direction);

    @Sql("delete from account_log where direction = ?")
    @Update
    void deleteByDirection(String direction);

    // 索引[trans_time]
    @Sql("select * from account_log where trans_time = ?")
    @Select
    AccountLogEntity findByTransTime(String transTime);

    @Sql("delete from account_log where trans_time = ?")
    @Update
    void deleteByTransTime(String transTime);

    // 索引[settle_time]
    @Sql("select * from account_log where settle_time = ?")
    @Select
    AccountLogEntity findBySettleTime(String settleTime);

    @Sql("delete from account_log where settle_time = ?")
    @Update
    void deleteBySettleTime(String settleTime);

    // 索引[partner_id]
    @Sql("select * from account_log where partner_id = ?")
    @Select
    AccountLogEntity findByPartnerId(String partnerId);

    @Sql("delete from account_log where partner_id = ?")
    @Update
    void deleteByPartnerId(String partnerId);
}